package com.baizan.daka.ui.fragment

import com.baizan.daka.base.BasePageListFragment
import com.baizan.daka.ui.contract.TaskedContract
import com.baizan.daka.mvp.model.bean.TaskInfoBean
import com.baizan.daka.ui.presenter.TaskedPresenter
import com.baizan.daka.net.BasePageResponse
import com.baizan.daka.ui.adapter.TaskedAdapter
import kotlinx.android.synthetic.main.frg_base_list.*

class TaskedFragment : BasePageListFragment<TaskedPresenter, TaskedAdapter>(), TaskedContract.View {

    override fun initPresenter(): TaskedPresenter? = TaskedPresenter(this)


    override fun initData() {
        super.initData()
    }

    override fun initView() {
    }

    override fun onHiddenChanged(hidden: Boolean) {
        super.onHiddenChanged(hidden)
        if(!hidden){
            toRefresh()
        }
    }
    override fun start() {
        presenter?.loadList(mCurrentPageNo)
    }

    override fun onRefresh() {
        presenter?.loadList(mCurrentPageNo)
    }

    override fun onLoadMore() {
        presenter?.loadList(mCurrentPageNo)
    }

    override fun initAdapter(): TaskedAdapter? = TaskedAdapter()
    override fun loadListSuccess(data: BasePageResponse<TaskInfoBean>) {
        getDatasSuccess(data)
    }

    override fun loadListFail(fail: String) {
        getDatasFail()
    }

}